//
//  Fruits1.m
//  FruitsWholesaler
//
//  Created by sgone-2 on 15/11/18.
//  Copyright © 2015年 sgone. All rights reserved.
//

#import "Fruits1.h"
#import "Fruits2.h"
@implementation Fruits1

-(instancetype)initWithDataDic:(NSDictionary *)dict
{

    if (self = [super init]) {
        _menuID = [dict[@"product_category_id"] integerValue];
        _fruits1Name = dict[@"product_category_name"];
        NSMutableArray *cates = @[].mutableCopy;
        if ([dict[@"child_list"] isKindOfClass:[NSArray class]]) {
            NSArray *cateList  = dict[@"child_list"];
           //苹果通过纯c语言添加，代码块进行遍历数组操作
            [cateList enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                NSDictionary *cateDic = obj;
                Fruits2 *fruits2 = [[Fruits2 alloc]initWithDataDict:cateDic];
                [cates addObject:fruits2];
                
                
            }];
            _fruits1 = cates;
\
        }
        
        
    }

    return self;

}

@end
